//
//  HM_Tool.h
//  HMSDK
//
//  Created by hm on 2017/5/26.
//  Copyright © 2017年 hm. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AdSupport/AdSupport.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>

static inline BOOL ICIsStringEmpty(NSString *string){
    
    if (string == NULL) {
        return YES;
    }
    
    if ([string isKindOfClass:[NSNull class]]) {
        return YES;
    }
    
    if ([string isEqualToString:@"<null>"]) {
        return YES;
    }
    
    if ([string isEqualToString:@"(null)"]) {
        return YES;
    }
    
    if ([string isEqualToString:@"null"]) {
        return YES;
    }
    
    return [[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0;
    
}
//工具类
@interface HMTools : NSObject
+(void)clearDisk;
+(NSString *) getAppName;
+(NSString *) getBundleID;
+(NSString *) getTimeStrWith:(NSString *)str;
+(NSString *) getIPAddress:(BOOL)preferIPv4;
+(NSString *) md5:(NSString *)input;
+(NSData *)decodeBase64:(NSString *)base64String;
+(NSData *)DESDecrypt:(NSData *)data WithKey:(NSString *)key;
+(NSString *) iphoneType;
+(NSString *) getLanguage;
+(NSString *) getIdfa;
+(NSString *)getMacAddress;
+(BOOL)matchNetwork;

+(void)printLog:(NSString *)log debug:(BOOL)debug;
+(int)cal:(int) num;//计算banner高度用到


+ (NSInteger)getYingjiNetworkType;
/**
 *  判断网络状态 0—未知 1—Ethernet 2—wifi 3—2G 4—3G 5—4G
 */
+ (NSInteger )getNetworkType;
//运营商
+ (NSString *)getcarrierName;
//得到一段字符串所占空间的高度
+ (CGSize)sizeWithString:(NSString *)str andFont:(UIFont *)font constrainedWithWidth:(CGFloat)width;
+ (void)getRequestWithURL:(NSString *)urlstring;
+ (void)getRequestWithUrls:(NSArray *)urls;
+ (void)getRequestWithUrls:(NSArray *)urls replaceUA:(NSString *)ua;
+ (UIColor *)colorAtPixel:(UIImage *)image point:(CGPoint)point;

+(BOOL)viewContainPoint:(int)width height:(int)height shrink:(int)shrink x:(int)x y:(int)y;

+(void)writeNumWithKey:(NSString *)key value:(NSNumber *)value;
+(NSNumber *)readNumByKey:(NSString *)key;

+(void)writeStrWithKey:(NSString *)key value:(NSString *)value;
+(NSString *)readStrByKey:(NSString *)key;

+(void)removeKey:(NSString *)key;

+(UIImage*)changeImageWithColor:(UIColor*) color;
@end
